package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BaseRole;
import com.briup.recognition.bean.BaseRoleExample;
import com.briup.recognition.dao.BaseRoleMapper;
import com.briup.recognition.service.BaseRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 冯琼华
 * @Date: 2021/03/28/20:54
 * @Description:
 */

@Service
public class BaseRoleServiceImpl implements BaseRoleService {

    @Resource
    private BaseRoleMapper baseRoleMapper;

    @Override
    public List<BaseRole> query() {
        BaseRoleExample example = new BaseRoleExample();
        return baseRoleMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(BaseRole baseRole) {
        if(baseRole.getId() != null){
            baseRoleMapper.updateByPrimaryKey(baseRole);
        }else {
            baseRoleMapper.insert(baseRole);
        }

    }

    @Override
    public void deleteBRSid(long id) {
        baseRoleMapper.deleteByPrimaryKey(id);
    }
}
